10 REM MOMENT METHOD SOLUTION TO A FOLDED WIRE DIPOLE
20 REM "ANTENNA DESIGN USING PERSONAL COMPUTERS"
30 DIM CR(11),CI(11),V(11),ZR(66),ZI(66),A(5)
40 DEF FNCABS(X,Y)=SQR(X*X+Y*Y)
50 DEF FNDIVR(X1,Y1,X2,Y2)=(X1*X2+Y1*Y2)/(X2*X2+Y2*Y2)
60 DEF FNDIVI(X1,Y1,X2,Y2)=(Y1*X2-X1*Y2)/(X2*X2+Y2*Y2)
70 DEF FNINDX(I,J,N)=(I-1)*N-(I*I-I)/2+J
80 PI=3.141593
90 KEY OFF
100 CLS
110 COLOR 1,0
120 PRINT "THIS PROGRAM DOES A MOMENT METHOD SOLUTION FOR A"
130 PRINT "FOLDED DIPOLE ANTENNA."
140 COLOR 4,0
150 PRINT
160 INPUT "WHAT IS THE FREQUENCY(MHz)";FMC
170 INPUT "WHAT IS THE DIPOLE LENGTH(meters)";DL
180 INPUT "WHAT ARE THE TWO CONDUCTOR RADII(meters)";R1,R2
190 INPUT "WHAT IS THE CONDUCTOR SEPARATION(meters)";DD
200 IF DD<=R1+R2 THEN GOTO 180
210 INPUT "HOW MANY PWS EXPANSION MODES(ODD) ON DIPOLE";N
220 IF N/2=INT(N/2) THEN GOTO 210
230 IF N>11 THEN GOTO 210
240 PRINT
250 COLOR 14,0
260 D=DL/(N+1)
270 NF=(N+1)/2
280 XK0=2*PI*FMC/300
290 IF D<.0628/XK0 THEN PRINT "CAUTION - SEGMENT LENGTH < 0.01 WVL."
300 REM COMPUTE CONSTANTS FOR FOLDED DIPOLE TRANSFORMATIONS
310 UU=R2/R1
320 VV=DD/R1
330 X=(1+VV*VV-UU*UU)/(2*VV)
340 HC1=LOG(X+SQR(X*X-1))
350 X=(VV*VV+UU*UU-1)/(2*VV*UU)
360 HC2=LOG(X+SQR(X*X-1))
370 AA=HC1/HC2
380 Z0=60*(HC1+HC2)
390 AM=R1*EXP((UU*UU*LOG(UU)+2*UU*LOG(VV))/(1+UU)^2)
400 ZF=1E+08
410 X=COS(XK0*DL/2)
420 IF ABS(X)>.001 THEN ZF=Z0*SIN(XK0*DL/2)/X
430 PRINT USING "EQUIVALENT RADIUS=#.###### meters";AM
440 REM COMPUTE Z MATRIX(TOP ROW ONLY)
450 SKD=SIN(XK0*D)
460 CKD=COS(XK0*D)
470 FOR I=1 TO N
480 FOR J=I TO N
490 K=FNINDX(I,J,N)
500 IF I>1 THEN GOTO 570
510 X0=(J-1)*D
520 GOSUB 2060
530 ZR(K)=ZMNR
540 ZI(K)=ZMNI
550 PRINT I,J,ZMNR,ZMNI
560 GOTO 600
570 K1=FNINDX(I-1,J-1,N)
580 ZR(K)=ZR(K1)
590 ZI(K)=ZI(K1)
600 NEXT J
610 NEXT I
620 REM COMPUTE VOLTAGE VECTOR
630 FOR I=1 TO N
640 V(I)=0
650 NEXT I
660 V(NF)=1
670 FOR I=1 TO N
680 CR(I)=V(I)
690 CI(I)=0
700 NEXT I
710 REM SOLVE ZI=V
720 GOSUB 960
730 ZINR=FNDIVR(1,0,CR(NF),CI(NF))
740 ZINI=FNDIVI(1,0,CR(NF),CI(NF))
750 REM PRINT CURRENT
760 PRINT "MODE #   CURRENT(RE,IM)"
770 FOR I=1 TO N
780 PRINT USING "   ##  ##.####  ##.####";I,CR(I),CI(I)
790 NEXT I
800 PRINT
810 PRINT USING "ISOLATED DIPOLE IMPEDANCE=####.## #####.## ohms";ZINR,ZINI
820 PRINT USING "T-LINE CHARACTERISTIC IMPEDANCE=####.# ohms";Z0
830 PRINT USING "TRANSFORMATION RATIO=###.###";(1+AA)^2
840 X1=2*(1+AA)^2*ZINI*(-ZF)
850 Y1=2*(1+AA)^2*ZINR*ZF
860 X2=(1+AA)^2*ZINR
870 Y2=(1+AA)^2*ZINI+2*ZF
880 ZINR=FNDIVR(X1,Y1,X2,Y2)
890 ZINI=FNDIVI(X1,Y1,X2,Y2)
900 PRINT USING "FOLDED DIPOLE INPUT IMPEDANCE=####.#  ####.# ohms";ZINR,ZINI
910 PRINT
920 COLOR 4,0
930 INPUT "CONTINUE(Y,N)";IS$
940 IF IS$="N" THEN GOTO 2340
950 GOTO 100
960 REM CHOLESKY LINEAR EQUATION SOLUTION
970 PHS=0
980 IF ZR(1)<>0 THEN PHS=ATN(ZI(1)/ZR(1))/2
990 MAG=SQR(FNCABS(ZR(1),ZI(1)))
1000 ZR(1)=MAG*COS(PHS)
1010 ZI(1)=MAG*SIN(PHS)
1020 FOR K=2 TO N
1030 ZINR=FNDIVR(ZR(K),ZI(K),ZR(1),ZI(1))
1040 ZINI=FNDIVI(ZR(K),ZI(K),ZR(1),ZI(1))
1050 ZR(K)=ZINR
1060 ZI(K)=ZINI
1070 NEXT K
1080 FOR I=2 TO N
1090 IMO=I-1
1100 IPO=I+1
1110 ID=(I-1)*N-(I*I-I)/2
1120 II=ID+I
1130 FOR L=1 TO IMO
1140 LI=FNINDX(L,I,N)
1150 ZINR=ZR(II)-ZR(LI)*ZR(LI)+ZI(LI)*ZI(LI)
1160 ZINI=ZI(II)-2*ZR(LI)*ZI(LI)
1170 ZR(II)=ZINR
1180 ZI(II)=ZINI
1190 NEXT L
1200 PHS=0
1210 IF ZR(II)<>0 THEN PHS=ATN(ZI(II)/ZR(II))/2
1220 MAG=SQR(FNCABS(ZR(II),ZI(II)))
1230 ZR(II)=MAG*COS(PHS)
1240 ZI(II)=MAG*SIN(PHS)
1250 IF IPO>N THEN GOTO 1420
1260 FOR J=IPO TO N
1270 IJ=ID+J
1280 FOR M=1 TO IMO
1290 MD=(M-1)*N-(M*M-M)/2
1300 MI=MD+I
1310 MJ=MD+J
1320 ZINR=ZR(IJ)-ZR(MJ)*ZR(MI)+ZI(MJ)*ZI(MI)
1330 ZINI=ZI(IJ)-ZR(MJ)*ZI(MI)-ZI(MJ)*ZR(MI)
1340 ZR(IJ)=ZINR
1350 ZI(IJ)=ZINI
1360 NEXT M
1370 ZINR=FNDIVR(ZR(IJ),ZI(IJ),ZR(II),ZI(II))
1380 ZINI=FNDIVI(ZR(IJ),ZI(IJ),ZR(II),ZI(II))
1390 ZR(IJ)=ZINR
1400 ZI(IJ)=ZINI
1410 NEXT J
1420 NEXT I
1430 ZINR=FNDIVR(CR(1),CI(1),ZR(1),ZI(1))
1440 ZINI=FNDIVI(CR(1),CI(1),ZR(1),ZI(1))
1450 CR(1)=ZINR
1460 CI(1)=ZINI
1470 FOR I=2 TO N
1480 IMO=I-1
1490 FOR L=1 TO IMO
1500 LI=FNINDX(L,I,N)
1510 ZINR=CR(I)-ZR(LI)*CR(L)+ZI(LI)*CI(L)
1520 ZINI=CI(I)-ZR(LI)*CI(L)-ZI(LI)*CR(L)
1530 CR(I)=ZINR
1540 CI(I)=ZINI
1550 NEXT L
1560 II=FNINDX(I,I,N)
1570 ZINR=FNDIVR(CR(I),CI(I),ZR(II),ZI(II))
1580 ZINI=FNDIVI(CR(I),CI(I),ZR(II),ZI(II))
1590 CR(I)=ZINR
1600 CI(I)=ZINI
1610 NEXT I
1620 NN=((N+1)*N)/2
1630 ZINR=FNDIVR(CR(N),CI(N),ZR(NN),ZI(NN))
1640 ZINI=FNDIVI(CR(N),CI(N),ZR(NN),ZI(NN))
1650 CR(N)=ZINR
1660 CI(N)=ZINI
1670 NMO=N-1
1680 FOR I=1 TO NMO
1690 K=N-I
1700 KPO=K+1
1710 KD=(K-1)*N-(K*K-K)/2
1720 FOR L=KPO TO N
1730 KL=KD+L
1740 ZINR=CR(K)-ZR(KL)*CR(L)+ZI(KL)*CI(L)
1750 ZINI=CI(K)-ZR(KL)*CI(L)-ZI(KL)*CR(L)
1760 CR(K)=ZINR
1770 CI(K)=ZINI
1780 NEXT L
1790 KK=KD+K
1800 ZINR=FNDIVR(CR(K),CI(K),ZR(KK),ZI(KK))
1810 ZINI=FNDIVI(CR(K),CI(K),ZR(KK),ZI(KK))
1820 CR(K)=ZINR
1830 CI(K)=ZINI
1840 NEXT I
1850 RETURN
1860 REM SUBROUTINE TO COMPUTE THE SINE AND COSINE INTEGRALS
1870 X2=X*X
1880 X4=X2*X2
1890 IF X>=1 THEN GOTO 1970
1900 X6=X2*X4
1910 X3=X*X2
1920 X5=X3*X2
1930 X7=X5*X2
1940 SI=X-X3/18+X5/600-X7/35280!
1950 CI=.57722+LOG(X)-X2/4+X4/96-X6/4320
1960 RETURN
1970 SX=SIN(X)
1980 CX=COS(X)
1990 FX=(X4+7.24116*X2+2.46394)/X
2000 FX=FX/(X4+9.068579*X2+7.15743)
2010 GX=(X4+7.54748*X2+1.56407)/X2
2020 GX=GX/(X4+12.72368*X2+15.72361)
2030 SI=1.57079-FX*CX-GX*SX
2040 CI=FX*SX-GX*CX
2050 RETURN
2060 REM COMPUTE ZMN TERMS
2070 A(1)=1
2080 A(5)=1
2090 A(2)=-4*CKD
2100 A(4)=A(2)
2110 A(3)=2+4*CKD*CKD
2120 ZMNR=0
2130 ZMNI=0
2140 FOR MM=-2 TO 2
2150 FOR NN=-1 TO 1 STEP 2
2160 TT=X0+MM*D
2170 BET=AM
2180 IF ABSYYAM THEN GOTO 2210
2190 BET=SQR(AM*AM+TT*TT)-NN*TT
2200 IF BET<AM/10 THEN BET=AM*AM/(2*ABS(TT))-AM^4/(8*ABS(TT)^3)
2210 X=BET*XK0
2220 ALP=XK0*NN*TT
2230 CALP=COS(ALP)
2240 SALP=SIN(ALP)
2250 GOSUB 1860
2260 ZMNR=ZMNR+A(MM+3)*(CALP*CI-SALP*SI)
2270 ZMNI=ZMNI-A(MM+3)*(SALP*CI+CALP*SI)
2280 NEXT NN
2290 NEXT MM
2300 SKDS=SKD*SKD
2310 ZMNR=ZMNR*15/SKDS
2320 ZMNI=ZMNI*15/SKDS
2330 RETURN
2340 COLOR 7,0
2350 KEY ON
2360 END
